curl --request POST \
--url https://api.hyperline.co/v1/customers/{id}/credits/{productId}/usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"usage_retained": 41,
"event_id": "<string>"
}
'{
"id": "cdt_BPZ19obsBS2qyo",
"product_id": "itm_3kXODDF42QXtnL",
"price": {
"id": "pri_0Jv8EbMDOGsHcn",
"amount": 20000,
"pack_size": 120
},
"customer_id": "cus_Typ0px2W0aiEtl",
"payment_method_id": "pm_1xMpj5bwRqN7LM",
"invoice_id": "inv_1eTaiytfA0i2Va",
"event_id": null,
"expires_at": null,
"type": "topup",
"source": "api",
"amount_excluding_tax": 123,
"credit_count": 32,
"balance_after": 2000,
"created_at": "2024-10-13T07:00:01.860Z",
"updated_at": "2024-10-13T07:00:01.860Z"
}Create a usage entry for a credit product. This will impact the balance of the customer by usage_retained.
curl --request POST \
--url https://api.hyperline.co/v1/customers/{id}/credits/{productId}/usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"usage_retained": 41,
"event_id": "<string>"
}
'{
"id": "cdt_BPZ19obsBS2qyo",
"product_id": "itm_3kXODDF42QXtnL",
"price": {
"id": "pri_0Jv8EbMDOGsHcn",
"amount": 20000,
"pack_size": 120
},
"customer_id": "cus_Typ0px2W0aiEtl",
"payment_method_id": "pm_1xMpj5bwRqN7LM",
"invoice_id": "inv_1eTaiytfA0i2Va",
"event_id": null,
"expires_at": null,
"type": "topup",
"source": "api",
"amount_excluding_tax": 123,
"credit_count": 32,
"balance_after": 2000,
"created_at": "2024-10-13T07:00:01.860Z",
"updated_at": "2024-10-13T07:00:01.860Z"
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Credit usage entry payload
The created credit transaction
Credit transaction ID.
"cdt_BPZ19obsBS2qyo"
ID of the product related to the transaction.
"itm_3kXODDF42QXtnL"
Price details related to the transaction.
Show child attributes
{
"id": "pri_0Jv8EbMDOGsHcn",
"amount": 20000,
"pack_size": 120
}ID of the customer related to the transaction.
"cus_Typ0px2W0aiEtl"
ID of the payment method related to the transaction.
"pm_1xMpj5bwRqN7LM"
ID of the invoice related to the transaction.
"inv_1eTaiytfA0i2Va"
ID of the event related to the credit consumption.
null
Expiration date for credits linked to this transaction
null
Type of credit transaction.
topup, usage, expiration "topup"
Type of credit transaction.
app, portal, api, system "api"
Monetary amount. Expressed in currency's smallest unit.
Value of credits related to the transaction.
32
Credit balance after the transaction.
2000
Was this page helpful?